# -*- encoding: utf-8 -*-
"""
@author: CarpeDiem
@data: 22/9/21
@version: 0.1
@description: 
@method: 不断开始计数进行比较，两层遍历，时间复杂度为O(n^2)，此时为了方便，使用字典统计
"""
def numEquivDominoPairs(dominoes):
    length = len(dominoes)
    count = 0
    for i in range(length):
        for j in range(i+1, length):
            if (dominoes[i] == dominoes[j]) or (dominoes[i] == dominoes[j][::-1]):
                count += 1
    return count

print(numEquivDominoPairs([[1,2],[2,1],[3,4],[5,6]]))